package com.qf.shopback.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.qf.entity.User;
import com.qf.fegin.api.IUservice;
import com.qf.resp.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;




@Controller
@RequestMapping("/user")
public class UserController {


    @Autowired
    private IUservice uservice;

    @RequestMapping("/getUserPage")
    public String getUserPage(Page<User>page, ModelMap modelMap){

        //获取数据
        page=uservice.getUserPage(page);
        //把page放入域中
        modelMap.put("page",page);

        //跳转到展示页面
        return "user/userList";
    }

    @RequestMapping("/addUser")
    @ResponseBody
    public ResultEntity addUser( User user){
        System.out.println(user);
        return uservice.addUser(user);
    }


}
